<!--
 * @Author: g05047
 * @Date: 2023-06-28 14:16:24
 * @LastEditors: g05047
 * @LastEditTime: 2023-11-20 13:57:24
 * @Description: file content
-->
<template>
	<el-card shadow="always">
		<!-- 查询-->

		<el-row :gutter="10">
			<el-col :span="5">
				<el-input
					placeholder="请输入许可证号"
					v-model="queryParams.newlicenseNo"
					clearable
				>
				</el-input>
			</el-col>
			<el-col :span="5">
				<el-input
					placeholder="请输入单位名称"
					v-model="queryParams.unitName"
					clearable
				>
				</el-input>
			</el-col>
			<el-col :span="2">
				<el-button type="primary" @click="handleQuery">查询</el-button>
			</el-col>
		</el-row>

		<!-- 表格数据 -->
		<el-table stripe border :data="tableDataA" style="width: 100%">
			<el-table-column
				align="center"
				prop="newLicenseNo"
				label="许可证号"
				width="160"
			>
				<template slot-scope="scope">
					<span
						@click="score(scope.row)"
						style="color: #1890ff; cursor: pointer"
					>
						{{ scope.row.newLicenseNo }}
					</span>
				</template>
			</el-table-column>

			<el-table-column align="center" prop="unitName" label="单位名称">
			</el-table-column>

			<el-table-column
				align="center"
				label="主体业态"
				show-overflow-tooltip
				width="240"
			>
				<template slot-scope="scope">
					<span>
						{{ scope.row.bodyindustry
						}}{{
							scope.row.bodyIndustryRemarks
								? "-" + scope.row.bodyIndustryRemarks
								: ""
						}}
					</span>
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				prop="superviseUnitName"
				label="监督机构"
				width="280"
			>
			</el-table-column>
			<el-table-column align="center" label="经营范围" width="360">
				<template slot-scope="scope">
					<span>
						{{
							scope.row.productBussiness
								? scope.row.productBussiness
								: scope.row.bussiness
						}}
					</span>
				</template>
			</el-table-column>
			<el-table-column
				align="center"
				label="操作"
				width="180"
				fixed="right"
			>
				<template slot-scope="scope">
					<el-button size="mini" @click="handleView(scope.row)">
						查看
					</el-button>
				</template>
			</el-table-column>
		</el-table>
		<!-- 分页 -->
		<el-pagination
			style="margin: 15px 0; float: right"
			background
			layout="total, prev, pager, next"
			:total="listLength"
			@current-change="handleCurrentChange"
			:current-page.sync="queryParams.current"
			:page-size.sync="queryParams.pageSize"
		>
		</el-pagination>
		<el-dialog
			title="查看"
			:visible.sync="dialogVisible"
			:close-on-click-modal="false"
			width="80%"
		>
			<el-tabs
				v-model="activeName"
				@tab-click="
					query.startDate = '';
					query.endDate = '';
					query.watchType = '';
					query.watchName = '';
					time = [];
					query.iotId = '';
					selectListAll = [];
					getLiatA();
				"
			>
				<el-tab-pane label="开关监控" name="1">
					<el-row :gutter="20">
						<el-col :span="7">
							<el-date-picker
								v-model="time"
								type="daterange"
								:clearable="false"
								value-format="yyyy-MM-dd"
								:picker-options="$pickerOptions"
								range-separator="至"
								start-placeholder="开始日期"
								end-placeholder="结束日期"
							>
							</el-date-picker>
						</el-col>
						<el-col :span="4">
							<el-input
								v-model="query.watchName"
								placeholder="请输入监控名称"
								clearable
							></el-input>
						</el-col>
						<el-col :span="4">
							<el-select
								v-model="query.watchType"
								clearable
								placeholder="请选择监控类型"
							>
								<el-option
									v-for="item in options"
									:key="item.value"
									:label="item.dicName"
									:value="item.id"
								>
								</el-option>
							</el-select>
						</el-col>

						<el-col :span="4">
							<el-select
								v-model="query.status"
								clearable
								placeholder="请选择状态"
							>
								<el-option
									v-for="item in [
										{
											name: '持续中',
											value: '0',
										},
										{
											name: '正常',
											value: '1',
										},
										{
											name: '预警',
											value: '2',
										},
									]"
									:key="item.value"
									:label="item.name"
									:value="item.value"
								>
								</el-option>
							</el-select>
						</el-col>

						<el-col :span="2">
							<el-button
								type="primary"
								@click="
									query.page = 1;
									getLiatA();
								"
								>搜索</el-button
							></el-col
						>
					</el-row>
					<rz-height />
					<el-button-group>
						<el-button
							:type="query.iotId == '' ? 'primary' : ''"
							@click="
								query.iotId = '';
								selectListAll = [];
								getLiatA();
							"
							>设备编号</el-button
						>
						<el-button
							:type="
								query.iotId.split(',').includes(item)
									? 'primary'
									: ''
							"
							@click="selectList(item)"
							v-for="item in buttonList"
							:key="item"
							>{{ item }}</el-button
						>
					</el-button-group>
					<rz-height />

					<el-table border :data="tableData" style="width: 100%">
						<el-table-column prop="generateTime" label="生成时间">
						</el-table-column>

						<el-table-column prop="iotId" label="设备编号">
						</el-table-column>

						<el-table-column prop="watchName" label="监控名称">
							<template slot-scope="scope">
								{{ scope.row.watchName || "--" }}
							</template>
						</el-table-column>
						<el-table-column prop="durationSecond" label="持续秒数">
							<template slot-scope="scope">
								{{ scope.row.durationSecond || "--" }}
							</template>
						</el-table-column>
						<el-table-column prop="watchType" label="监控类型">
							<template slot-scope="scope">
								<span v-if="scope.row.watchType == '1'"
									>仓库温湿度监测</span
								>
								<span v-else-if="scope.row.watchType == '3'"
									>留样冰箱温湿度监测</span
								>
								<span v-else-if="scope.row.watchType == '4'"
									>消毒柜、消毒车监测</span
								>
								<span v-else-if="scope.row.watchType == '5'"
									>紫外消毒监测</span
								>
								<span v-else-if="scope.row.watchType == '6'"
									>仓库挡鼠板监测</span
								>
								<span v-else-if="scope.row.watchType == '7'"
									>专间门窗监测</span
								>
								<span v-else-if="scope.row.watchType == '8'"
									>仓储围栏监测器</span
								>
							</template>
						</el-table-column>
						<el-table-column prop="switchType" label="开关">
							<template slot-scope="scope">
								{{ scope.row.switchType == 0 ? "关" : "开" }}
							</template>
						</el-table-column>
						<el-table-column prop="status" label="状态">
							<template slot-scope="scope">
								<span v-if="scope.row.status == 0">持续中</span>
								<span v-else-if="scope.row.status == 1"
									>正常</span
								>
								<span v-else-if="scope.row.status == 2"
									>预警</span
								>
							</template>
						</el-table-column>
					</el-table>

					<pagination
						:total="total"
						@pagination="getLiatA"
						:page.sync="query.page"
					/>
				</el-tab-pane>
				<el-tab-pane label="温湿度监控" name="2">
					<el-row :gutter="20">
						<el-col :span="7">
							<el-date-picker
								v-model="time"
								type="daterange"
								:clearable="false"
								value-format="yyyy-MM-dd"
								:picker-options="$pickerOptions"
								range-separator="至"
								start-placeholder="开始日期"
								end-placeholder="结束日期"
							>
							</el-date-picker>
						</el-col>
						<el-col :span="4">
							<el-input
								v-model="query.watchName"
								placeholder="请输入监控名称"
								clearable
							></el-input>
						</el-col>
						<el-col :span="4">
							<el-select
								v-model="query.watchType"
								clearable
								placeholder="请选择监控类型"
							>
								<el-option
									v-for="item in options"
									:key="item.value"
									:label="item.dicName"
									:value="item.id"
								>
								</el-option>
							</el-select>
						</el-col>

						<el-col :span="4">
							<el-select
								v-model="query.status"
								clearable
								placeholder="请选择状态"
							>
								<el-option
									v-for="item in [
										{
											name: '持续中',
											value: '0',
										},
										{
											name: '正常',
											value: '1',
										},
										{
											name: '预警',
											value: '2',
										},
									]"
									:key="item.value"
									:label="item.name"
									:value="item.value"
								>
								</el-option>
							</el-select>
						</el-col>

						<el-col :span="2">
							<el-button
								type="primary"
								@click="
									query.page = 1;
									getLiatA();
								"
								>搜索</el-button
							></el-col
						>
					</el-row>
					<rz-height />
					<el-button-group>
						<el-button
							:type="query.iotId == '' ? 'primary' : ''"
							@click="
								query.iotId = '';
								selectListAll = [];
								getLiatA();
							"
							>设备编号</el-button
						>
						<el-button
							:type="
								query.iotId.split(',').includes(item)
									? 'primary'
									: ''
							"
							@click="selectList(item)"
							v-for="item in buttonList"
							:key="item"
							>{{ item }}</el-button
						>
					</el-button-group>
					<rz-height />
					<el-table border :data="tableData" style="width: 100%">
						<el-table-column prop="generateTime" label="生成时间">
						</el-table-column>
						<el-table-column prop="iotId" label="设备编号">
						</el-table-column>
						<el-table-column prop="watchName" label="监控名称">
							<template slot-scope="scope">
								{{ scope.row.watchName || "--" }}
							</template>
						</el-table-column>
						<el-table-column prop="numi" label="湿度(%)">
						</el-table-column>

						<el-table-column prop="t1" label="温度(℃)">
							<template slot-scope="scope">
								{{ scope.row.t1 || "--" }}
							</template>
						</el-table-column>
						<el-table-column prop="watchType" label="监控类型">
							<template slot-scope="scope">
								<span v-if="scope.row.watchType == '1'"
									>仓库温湿度监测</span
								>
								<span v-else-if="scope.row.watchType == '3'"
									>留样冰箱温湿度监测</span
								>
								<span v-else-if="scope.row.watchType == '4'"
									>消毒柜、消毒车监测</span
								>
								<span v-else-if="scope.row.watchType == '5'"
									>紫外消毒监测</span
								>
								<span v-else-if="scope.row.watchType == '6'"
									>仓库挡鼠板监测</span
								>
								<span v-else-if="scope.row.watchType == '7'"
									>专间门窗监测</span
								>
								<span v-else-if="scope.row.watchType == '8'"
									>仓储围栏监测器</span
								>
							</template>
						</el-table-column>

						<el-table-column prop="status" label="状态">
							<template slot-scope="scope">
								<span v-if="scope.row.status == 0">持续中</span>
								<span v-else-if="scope.row.status == 1"
									>正常</span
								>
								<span v-else-if="scope.row.status == 2"
									>预警</span
								>
							</template>
						</el-table-column>
					</el-table>

					<pagination
						:total="total"
						@pagination="getLiatA"
						:page.sync="query.page"
					/>
				</el-tab-pane>
				<el-tab-pane label="红外线监控" name="3" v-if="false">
					<el-row :gutter="20">
						<el-col :span="7">
							<el-date-picker
								v-model="time"
								type="daterange"
								:clearable="false"
								value-format="yyyy-MM-dd"
								:picker-options="$pickerOptions"
								range-separator="至"
								start-placeholder="开始日期"
								end-placeholder="结束日期"
							>
							</el-date-picker>
						</el-col>
						<el-col :span="4">
							<el-input
								v-model="query.watchName"
								placeholder="请输入监控名称"
								clearable
							></el-input>
						</el-col>
						<el-col :span="4">
							<el-select
								v-model="query.watchType"
								clearable
								placeholder="请选择监控类型"
							>
								<el-option
									v-for="item in options"
									:key="item.value"
									:label="item.dicName"
									:value="item.id"
								>
								</el-option>
							</el-select>
						</el-col>

						<el-col :span="4">
							<el-select
								v-model="query.status"
								clearable
								placeholder="请选择状态"
							>
								<el-option
									v-for="item in [
										{
											name: '持续中',
											value: '0',
										},
										{
											name: '正常',
											value: '1',
										},
										{
											name: '预警',
											value: '2',
										},
									]"
									:key="item.value"
									:label="item.name"
									:value="item.value"
								>
								</el-option>
							</el-select>
						</el-col>

						<el-col :span="2">
							<el-button
								type="primary"
								@click="
									query.page = 1;
									getLiatA();
								"
								>搜索</el-button
							></el-col
						>
					</el-row>
					<rz-height />
					<el-button-group>
						<el-button
							:type="query.iotId == '' ? 'primary' : ''"
							@click="
								query.iotId = '';
								selectListAll = [];
								getLiatA();
							"
							>设备编号</el-button
						>
						<el-button
							:type="
								query.iotId.split(',').includes(item)
									? 'primary'
									: ''
							"
							@click="selectList(item)"
							v-for="(item, index) in buttonList"
							:key="index"
							>{{ item }}</el-button
						>
					</el-button-group>
					<rz-height />
					<el-table border :data="tableData" style="width: 100%">
						<el-table-column prop="generateTime" label="生成时间">
						</el-table-column>
						<el-table-column prop="iotId" label="设备编号">
						</el-table-column>
						<el-table-column prop="watchName" label="监控名称">
							<template slot-scope="scope">
								{{ scope.row.watchName || "--" }}
							</template>
						</el-table-column>
						<el-table-column prop="durationSecond" label="持续秒数">
							<template slot-scope="scope">
								{{ scope.row.durationSecond || "--" }}
							</template>
						</el-table-column>
						<el-table-column prop="watchType" label="监控类型">
							<template slot-scope="scope">
								<span v-if="scope.row.watchType == '1'"
									>仓库温湿度监测</span
								>
								<span v-else-if="scope.row.watchType == '3'"
									>留样冰箱温湿度监测</span
								>
								<span v-else-if="scope.row.watchType == '4'"
									>消毒柜、消毒车监测</span
								>
								<span v-else-if="scope.row.watchType == '5'"
									>紫外消毒监测</span
								>
								<span v-else-if="scope.row.watchType == '6'"
									>仓库挡鼠板监测</span
								>
								<span v-else-if="scope.row.watchType == '7'"
									>专间门窗监测</span
								>
								<span v-else-if="scope.row.watchType == '8'"
									>仓储围栏监测器</span
								>
							</template>
						</el-table-column>
						<el-table-column prop="switchType" label="开关">
							<template slot-scope="scope">
								{{ scope.row.switchType == 0 ? "关" : "开" }}
							</template>
						</el-table-column>
						<el-table-column prop="status" label="状态">
							<template slot-scope="scope">
								<span v-if="scope.row.status == 0">持续中</span>
								<span v-else-if="scope.row.status == 1"
									>正常</span
								>
								<span v-else-if="scope.row.status == 2"
									>预警</span
								>
							</template>
						</el-table-column>
					</el-table>

					<pagination
						:total="total"
						@pagination="getLiatA"
						:page.sync="query.page"
					/>
				</el-tab-pane>
				<el-tab-pane label="门磁监控" name="4">
					<el-row :gutter="20">
						<el-col :span="7">
							<el-date-picker
								v-model="time"
								type="daterange"
								:clearable="false"
								value-format="yyyy-MM-dd"
								:picker-options="$pickerOptions"
								range-separator="至"
								start-placeholder="开始日期"
								end-placeholder="结束日期"
							>
							</el-date-picker>
						</el-col>
						<el-col :span="4">
							<el-input
								v-model="query.watchName"
								placeholder="请输入监控名称"
								clearable
							></el-input>
						</el-col>
						<el-col :span="4">
							<el-select
								v-model="query.watchType"
								clearable
								placeholder="请选择监控类型"
							>
								<el-option
									v-for="item in options"
									:key="item.value"
									:label="item.dicName"
									:value="item.id"
								>
								</el-option>
							</el-select>
						</el-col>

						<el-col :span="4">
							<el-select
								v-model="query.status"
								clearable
								placeholder="请选择状态"
							>
								<el-option
									v-for="item in [
										{
											name: '持续中',
											value: '0',
										},
										{
											name: '正常',
											value: '1',
										},
										{
											name: '预警',
											value: '2',
										},
									]"
									:key="item.value"
									:label="item.name"
									:value="item.value"
								>
								</el-option>
							</el-select>
						</el-col>

						<el-col :span="2">
							<el-button
								type="primary"
								@click="
									query.page = 1;
									getLiatA();
								"
								>搜索</el-button
							></el-col
						>
					</el-row>
					<rz-height />
					<el-button-group>
						<el-button
							:type="query.iotId == '' ? 'primary' : ''"
							@click="
								query.iotId = '';
								selectListAll = [];
								getLiatA();
							"
							>设备编号</el-button
						>
						<el-button
							:type="
								query.iotId.split(',').includes(item)
									? 'primary'
									: ''
							"
							@click="selectList(item)"
							v-for="(item, index) in buttonList"
							:key="index"
							>{{ item }}</el-button
						>
					</el-button-group>
					<rz-height />
					<el-table border :data="tableData" style="width: 100%">
						<el-table-column prop="generateTime" label="生成时间">
						</el-table-column>
						<el-table-column prop="iotId" label="设备编号">
						</el-table-column>
						<el-table-column prop="watchName" label="监控名称">
							<template slot-scope="scope">
								{{ scope.row.watchName || "--" }}
							</template>
						</el-table-column>
						<el-table-column prop="durationSecond" label="持续秒数">
							<template slot-scope="scope">
								{{ scope.row.durationSecond || "--" }}
							</template>
						</el-table-column>
						<el-table-column prop="watchType" label="监控类型">
							<template slot-scope="scope">
								<span v-if="scope.row.watchType == '1'"
									>仓库温湿度监测</span
								>
								<span v-else-if="scope.row.watchType == '3'"
									>留样冰箱温湿度监测</span
								>
								<span v-else-if="scope.row.watchType == '4'"
									>消毒柜、消毒车监测</span
								>
								<span v-else-if="scope.row.watchType == '5'"
									>紫外消毒监测</span
								>
								<span v-else-if="scope.row.watchType == '6'"
									>仓库挡鼠板监测</span
								>
								<span v-else-if="scope.row.watchType == '7'"
									>专间门窗监测</span
								>
								<span v-else-if="scope.row.watchType == '8'"
									>仓储围栏监测器</span
								>
							</template>
						</el-table-column>
						<el-table-column prop="switchType" label="开关">
							<template slot-scope="scope">
								{{ scope.row.switchType == 0 ? "关" : "开" }}
							</template>
						</el-table-column>
						<el-table-column prop="status" label="状态">
							<template slot-scope="scope">
								<span v-if="scope.row.status == 0">持续中</span>
								<span v-else-if="scope.row.status == 1"
									>正常</span
								>
								<span v-else-if="scope.row.status == 2"
									>预警</span
								>
							</template>
						</el-table-column>
					</el-table>

					<pagination
						:total="total"
						@pagination="getLiatA"
						:page.sync="query.page"
					/>
				</el-tab-pane>

				<el-tab-pane label="预警信息" name="5">
					<!-- <el-empty :image-size="100"></el-empty> -->
					<el-row :gutter="10">
						<el-col :span="4">
							<el-date-picker
								style="width: 100%"
								v-model="AIWarmingDate"
								type="daterange"
								:clearable="false"
								value-format="yyyy-MM-dd"
								:picker-options="$pickerOptions"
								range-separator="-"
								start-placeholder="开始日期"
								end-placeholder="结束日期"
							>
							</el-date-picker>
						</el-col>
						<el-col :span="4">
							<el-input
								v-model="AIWarmingQueryParams.name"
								placeholder="请输入监控点名称"
								clearable
							></el-input>
						</el-col>
						<el-col :span="2">
							<el-select
								v-model="AIWarmingQueryParams.handleStatus"
								clearable
								placeholder="处置状态"
							>
								<el-option label="已处置" :value="1">
								</el-option>
								<el-option label="未处置" :value="0">
								</el-option>
							</el-select>
						</el-col>
						<el-col :span="2">
							<el-button
								type="primary"
								@click="
									AIWarmingQueryParams.page = 1;
									getAIWarmingList();
								"
							>
								搜索
							</el-button>
						</el-col>
					</el-row>
					<rz-height />
					<el-table
						border
						:data="AIWarmingTableData"
						style="width: 100%"
					>
						<el-table-column
							prop="happenTime"
							label="事件发生日期"
							width="160"
							align="center"
						>
						</el-table-column>
						<el-table-column
							prop="name"
							label="监控点名称"
							align="center"
						>
						</el-table-column>
						<el-table-column
							prop="eventName"
							label="事件名称"
							align="center"
						>
						</el-table-column>
						<el-table-column
							prop="tipDetails"
							label="预警详情"
							align="center"
						>
						</el-table-column>
						<el-table-column
							label="告警照片"
							width="100"
							align="center"
						>
							<template slot-scope="scope">
								<el-image
									style="
										width: 50px;
										height: 50px;
										cursor: pointer;
									"
									:src="scope.row.picUrlRect"
									fit="cover"
									:preview-src-list="[scope.row.picUrlRect]"
								></el-image>
							</template>
						</el-table-column>
						<el-table-column
							align="center"
							prop="handleStatusStr"
							label="处置状态"
							width="100"
						></el-table-column>
						<el-table-column
							align="center"
							prop="handleTime"
							label="处置时间"
							width="160"
						></el-table-column>
						<el-table-column
							align="center"
							prop="handleMethod"
							label="处置方法"
							show-overflow-tooltip
						></el-table-column>
						<el-table-column
							align="center"
							label="操作"
							width="200"
						>
							<template slot-scope="scope">
								<div>
									<el-button
										size="mini"
										@click="handleViewWarning(scope.row)"
									>
										查看
									</el-button>
									<el-button
										v-if="scope.row.handleStatus === 0"
										size="mini"
										type="primary"
										@click="handleEditWarning(scope.row)"
									>
										立即处置
									</el-button>
								</div>
							</template>
						</el-table-column>
					</el-table>
					<pagination
						:total="AIWarmingListTotal"
						@pagination="getAIWarmingList"
						:page.sync="AIWarmingQueryParams.page"
					/>
				</el-tab-pane>
				<el-tab-pane label="人证通行记录" name="6">
					<el-row :gutter="10">
						<el-col :span="4">
							<el-date-picker
								style="width: 100%"
								v-model="passRecordDate"
								type="daterange"
								:clearable="false"
								value-format="yyyy-MM-dd"
								:picker-options="$pickerOptions"
								range-separator="-"
								start-placeholder="开始日期"
								end-placeholder="结束日期"
							>
							</el-date-picker>
						</el-col>
						<el-col :span="4">
							<el-input
								v-model="passRecordQueryParams.memberJobNum"
								placeholder="请输入人员工号"
								clearable
							></el-input>
						</el-col>
						<el-col :span="4">
							<el-input
								v-model="passRecordQueryParams.memberName"
								placeholder="请输入人员名称"
								clearable
							></el-input>
						</el-col>
						<el-col :span="2">
							<el-button
								type="primary"
								@click="
									passRecordQueryParams.page = 1;
									getPassRecordList();
								"
							>
								搜索
							</el-button>
						</el-col>
					</el-row>
					<rz-height />
					<el-table
						border
						:data="passRecordTableData"
						style="width: 100%"
					>
						<el-table-column
							prop="deviceCurrentDateStr"
							label="通行时间"
							align="center"
						>
						</el-table-column>
						<el-table-column
							prop="memberJobNum"
							label="人员工号"
							align="center"
						>
						</el-table-column>
						<el-table-column
							prop="memberName"
							label="人员名称"
							align="center"
						>
						</el-table-column>
						<el-table-column
							prop="validityDateStr"
							label="健康证有效期至"
							align="center"
						>
							<template slot-scope="scope">
								{{ scope.row.validityDateStr || "--" }}
							</template>
						</el-table-column>
						<el-table-column
							prop="temperature"
							label="人员体温"
							align="center"
						>
							<template slot-scope="scope">
								{{ scope.row.temperature || "--" }}
							</template>
						</el-table-column>
					</el-table>
					<pagination
						:total="passRecordListTotal"
						@pagination="getPassRecordList"
						:page.sync="passRecordQueryParams.page"
					/>
				</el-tab-pane>
			</el-tabs>

			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisible = false">关 闭</el-button>
			</span>
		</el-dialog>

		<view-dialog ref="viewDialog"></view-dialog>
		<edit-dialog ref="editDialog" @getList="getList"></edit-dialog>
	</el-card>
</template>
<script>
import {
	getCreditFile,
	licenseAcquisitionId,
	findVideoSnapped,
	findVideoSnappedById,
	findPersonPassRecord,
} from "@/api/modules/enterprise.js";
import axios from "axios";

import ViewDialog from "./components/ViewDialog.vue";
import EditDialog from "./components/EditDialog.vue";
export default {
	props: [],

	// 组件
	components: { ViewDialog, EditDialog },

	data() {
		return {
			activeName: "1",
			query: {
				licenceNo: "",
				watchName: "",
				watchType: "",
				status: "",
				page: 1,
				size: 10,
				startDate: "",
				endDate: "",
				iotId: "",
			},
			selectListAll: [],
			options: [],
			tableData: [],
			total: 0,
			time: [],
			buttonList: [],
			dialogVisible: false,
			queryParams: {
				isSpecialFood: "",
				selectType: 0,
				address: "", //单位地址
				bodyIndustry: "", //主体业态
				bodyIndustryRemark: [], //主体业态备注信息['string']
				bussiness: [], //经营范围
				bussinessChlid: [], //经营范围第二层
				checkStatus: "", //检查状态 2未查 1已查
				checkYear: `${new Date().getFullYear()}`, //检查年份，默认本年
				current: 1, //当前页
				startDate: "", //开始日期
				endDate: "", //结束日期
				// foodSafetyIndex: "", //食安指数
				indexScore: "", //精准画像指数
				identifyState: "", //企业信用档案状态
				isLawCheck: "", //是否稽查执法
				isReport: "", //是否举报
				isSpotCheck: 0, //是否抽检
				lawCaseNum: "", //稽查执法次数
				legal: "", //法人
				licenseStatus: 1, //许可证状态
				newlicenseNo: "", //许可证号
				identify: "", //信用代码
				pageSize: 10, //每页数量
				reportNum: "", //举报数量
				riskStep: "", //风险等级 2未做 1已做
				unspotCheckNum: "", //抽检数量
				unitId: "8E543E8F907E4499B6D2BA2DFC63A862", //检查机构Id
				unitName: "", //单位名称
				unitStatus: 0, //单位状态
				order: 1, //指数排序顺序 2升序 1降序
				orderItem: 0, //排序项 0默认不排序 1食安指数排序 2 抽检次数排序 3 举报次数排序 4执法次数排序
				isNetwork: "", //网络经营
				isCentralKitchen: "", //中央厨房
				isCollectiveDelivery: "", //集体配送
				directorUnitTypes: "", //主体责任类型
				count: "",
				applicationMethod: "", //申请方式
				cerStartDate: "", ///发证开始日期
				cerEndDate: "", //发证结束日期
				unitTypes: "预警AI",
			},
			list: [],
			tableDataA: [],
			listLength: 0,

			AIWarmingDate: [],
			AIWarmingQueryParams: {
				endHappenTime: "", //事件发生时间 结束日期
				firstIndex: 0,
				firstIndexNew: 0,
				isPage: 0, //是否分页 0 分页 非0 不分页
				lastIndex: 0,
				lastIndexNew: 0,
				name: "", //监控点名称
				newlicenseno: "", //许可证
				page: 1, //页码
				pageSize: 10, //每页最大数量
				startHappenTime: "", //事件发生时间 开始日期
				unitname: "", //单位名称
			},
			AIWarmingTableData: [],
			AIWarmingListTotal: 0,

			passRecordDate: [],
			passRecordQueryParams: {
				comparedEndDate: "", //查询结束时间
				comparedStartDate: "", //查询开始时间
				firstIndex: 0, //
				firstIndexNew: 0, //
				isPage: 0, //是否分页 0 分页 非0 不分页
				lastIndex: 0, //
				lastIndexNew: 0, //
				memberJobNum: "", //人员工号 模糊查询
				memberName: "", //人员名称 模糊查询
				newlicenseno: "", //许可证
				page: 1, //页码
				pageSize: 10, //每页最大数量
				unitname: "", //单位名称
			},
			passRecordTableData: [],
			passRecordListTotal: 0,
		};
	},

	//页面加载
	created() {
		this.getCreditFileAsync();

		// this.findListByCategory();
	}, // 页面加载完成
	mounted() {}, //实例销毁之前
	beforeDestroy() {}, //实例销毁后
	destroyed() {},
	methods: {
		handleViewWarning(data) {
			this.$refs.viewDialog.handleOpen(data);
		},

		handleEditWarning(data) {
			this.$refs.editDialog.handleOpen(data);
		},
		async getPassRecordList() {
			try {
				this.passRecordQueryParams.comparedStartDate =
					this.passRecordDate[0];
				this.passRecordQueryParams.comparedEndDate =
					this.passRecordDate[1];
				const res = await findPersonPassRecord(
					this.passRecordQueryParams,
				);
				if (res.code === 200) {
					//
					this.passRecordTableData = res.data.list;
					this.passRecordListTotal = res.data.total;
				}
			} catch (error) {
				this.$message.error(err);
				console.log(err);
			}
		},

		async getAIWarmingList() {
			try {
				this.AIWarmingQueryParams.startHappenTime =
					this.AIWarmingDate[0];
				this.AIWarmingQueryParams.endHappenTime = this.AIWarmingDate[1];

				const paramsCopy = JSON.parse(
					JSON.stringify(this.AIWarmingQueryParams),
				);
				if (this.AIWarmingQueryParams.handleStatus === "") {
					paramsCopy.handleStatus = -1;
				}

				const res = await findVideoSnapped(paramsCopy);
				if (res.code === 200) {
					this.AIWarmingTableData = res.data.list;
					this.AIWarmingListTotal = res.data.total;
				}
			} catch (err) {
				this.$message.error(err);
				console.log(err);
			}
		},

		async score(e) {
			const res = await licenseAcquisitionId({
				params: {
					newLicenseNo: e.newLicenseNo,
				},
			});
			sessionStorage.setItem("newLicenseNo", e.newLicenseNo);
			sessionStorage.setItem("interpretation", res.data);
			this.$router.push({
				path: "/interpretation/home?url=/foodSafety/archives/archives",
				// query: { id: e.id },
			});
		},

		selectListAllS() {
			if (this.selectListAll.length == 0) {
				this.selectListAll = this.buttonList.map((x) => x);
				this.query.iotId = this.selectListAll.join(",");
			} else {
				this.selectListAll = [];
				this.query.iotId = "";
			}
		},
		selectList(e) {
			if (this.selectListAll.includes(e)) {
				this.selectListAll.splice(
					this.selectListAll.findIndex((x) => x == e),
					1,
				);
			} else {
				this.selectListAll.push(e);
			}
			this.query.iotId = this.selectListAll.join(",");
			this.getLiatA();
		},
		getLiatA() {
			this.total = 0;
			this.tableData = [];
			this.options = [];
			if (this.time.length) {
				this.query.startDate = this.time[0];
				this.query.endDate = this.time[1];
			}
			//
			if (this.activeName == "1") {
				this.getList();
			} else if (this.activeName == "2") {
				this.getList1();
			} else if (this.activeName == "3") {
				this.getList2();
			} else if (this.activeName == "4") {
				this.getList3();
			} else if (this.activeName == "5") {
				this.getAIWarmingList();
			} else if (this.activeName == "6") {
				this.getPassRecordList();
			}
		},
		getList() {
			axios
				.get("https://wlsa.etmobile.net/wlsa-api/ps", {
					params: this.query,
				})
				.then((res) => {
					this.tableData = res.data.data.list;
					this.total = res.data.data.total;
				});
			axios
				.get("https://wlsa.etmobile.net/wlsa-api/sys-dic", {
					params: {
						category: "device_ps",
						isEnable: 1,
					},
				})
				.then((res) => {
					this.options = res.data.data.list;
				});

			axios
				.get("https://wlsa.etmobile.net/wlsa-api/list-iot-id", {
					params: {
						licenceNo: this.query.licenceNo,
						model: "ps",
					},
				})
				.then((res) => {
					this.buttonList = res.data.data;
				});
		},
		getList1() {
			axios
				.get("https://wlsa.etmobile.net/wlsa-api/th", {
					params: this.query,
				})
				.then((res) => {
					this.tableData = res.data.data.list;
					this.total = res.data.data.total;
				});
			axios
				.get("https://wlsa.etmobile.net/wlsa-api/sys-dic", {
					params: {
						category: "device_th",
						isEnable: 1,
					},
				})
				.then((res) => {
					this.options = res.data.data.list;
				});
			axios
				.get("https://wlsa.etmobile.net/wlsa-api/list-iot-id", {
					params: {
						licenceNo: this.query.licenceNo,
						model: "th",
					},
				})
				.then((res) => {
					this.buttonList = res.data.data;
				});
		},
		getList2() {
			axios
				.get("https://wlsa.etmobile.net/wlsa-api/rs", {
					params: this.query,
				})
				.then((res) => {
					this.tableData = res.data.data.list;
					this.total = res.data.data.total;
				});
			axios
				.get("https://wlsa.etmobile.net/wlsa-api/sys-dic", {
					params: {
						category: "device_rs",
						isEnable: 1,
					},
				})
				.then((res) => {
					this.options = res.data.data.list;
				});
			axios
				.get("https://wlsa.etmobile.net/wlsa-api/list-iot-id", {
					params: {
						licenceNo: this.query.licenceNo,
						model: "rs",
					},
				})
				.then((res) => {
					this.buttonList = res.data.data;
				});
		},
		getList3() {
			axios
				.get("https://wlsa.etmobile.net/wlsa-api/mg", {
					params: this.query,
				})
				.then((res) => {
					this.tableData = res.data.data.list;
					this.total = res.data.data.total;
				});

			axios
				.get("https://wlsa.etmobile.net/wlsa-api/sys-dic", {
					params: {
						category: "device_mg",
						isEnable: 1,
					},
				})
				.then((res) => {
					this.options = res.data.data.list;
				});

			axios
				.get("https://wlsa.etmobile.net/wlsa-api/list-iot-id", {
					params: {
						licenceNo: this.query.licenceNo,
						model: "mg",
					},
				})
				.then((res) => {
					this.buttonList = res.data.data;
				});
		},

		//查询
		handleQuery() {
			this.queryParams.current = 1;
			this.getCreditFileAsync();
		},

		//查看
		handleView(e) {
			// console.log(e.newLicenseNo);
			this.query.licenceNo = e.newLicenseNo;
			this.AIWarmingQueryParams.newlicenseno = e.newLicenseNo;
			this.passRecordQueryParams.newlicenseno = e.newLicenseNo;

			this.AIWarmingQueryParams.page = 1;
			this.passRecordQueryParams.page = 1;

			this.getLiatA();
			this.dialogVisible = true;
			// this.$message.info("正在开发中...");

			// this.$router.push({
			//   path: "/unitHomePage/unitHomePage",
			//   query: { id: val.id },
			// });
		},

		//分页
		handleCurrentChange(val) {
			this.queryParams.current = val;
			this.getCreditFileAsync();
		},

		//企业信息列表
		async getCreditFileAsync() {
			try {
				if (
					this.selectedDateArrFZ &&
					this.selectedDateArrFZ.length > 0
				) {
					this.queryParams.cerStartDate = this.selectedDateArrFZ[0];
					this.queryParams.cerEndDate = this.selectedDateArrFZ[1];
				} else {
					this.queryParams.cerStartDate = "";
					this.queryParams.cerEndDate = "";
				}

				if (this.queryParams.checkYear !== "") {
					this.queryParams.startDate = "";
					this.queryParams.endDate = "";
				} else {
					this.queryParams.startDate = this.selectedDateArr[0];
					this.queryParams.endDate = this.selectedDateArr[1];
				}

				const paramsCopy = JSON.parse(JSON.stringify(this.queryParams));
				if (this.queryParams.isSpotCheck === true) {
					paramsCopy.isSpotCheck = 1;
				} else {
					paramsCopy.isSpotCheck = 0;
				}
				if (this.queryParams.isReport === true) {
					paramsCopy.isReport = 1;
				} else {
					paramsCopy.isReport = 0;
				}
				if (this.queryParams.isLawCheck === true) {
					paramsCopy.isLawCheck = 1;
				} else {
					paramsCopy.isLawCheck = 0;
				}
				if (this.queryParams.isNetwork === true) {
					paramsCopy.isNetwork = 1;
				} else {
					paramsCopy.isNetwork = 2;
				}
				if (this.queryParams.isCentralKitchen === true) {
					paramsCopy.isCentralKitchen = 1;
				} else {
					paramsCopy.isCentralKitchen = 2;
				}
				if (this.queryParams.isCollectiveDelivery === true) {
					paramsCopy.isCollectiveDelivery = 1;
				} else {
					paramsCopy.isCollectiveDelivery = 2;
				}

				if (!this.queryParams.unitId) {
					paramsCopy.unitId = this.userInfo.unitId;
				}

				if (this.queryParams.licenseStatus === "") {
					paramsCopy.licenseStatus = -1;
				}
				if (this.queryParams.unitStatus === "") {
					paramsCopy.unitStatus = -1;
				}

				// unitTypes:[]
				const res = await getCreditFile(paramsCopy);
				if (res.code === 200) {
					this.tableDataA = res.data;
					this.listLength = res.totalCount;
					this.loading = false;
				}
			} catch (err) {
				console.log(err);
			}
		},
	}, //方法

	computed: {}, //计算属性
};
</script>
<style lang="scss" scoped>
.el-col {
	margin-bottom: 10px;
}
</style>
